/**
 * fulihui.com Inc.
 * Copyright (c) 2015-2016 All Rights Reserved.
 */
package com.fulihui.integral.core.handler;

import com.fulihui.integral.core.enums.ISChannelType;
import com.fulihui.integral.core.request.ISUserBehaviorReq;
import com.fulihui.mscore.enums.MsgTypeEnum;
import com.fulihui.mscore.request.MsgCreateRequest;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 有益反馈
 *
 * @author zhangyingjie
 * @version $Id: v 0.1 2017年06月15日 15:24 zhangyingjie Exp $
 */
@Component("feedbackBusinessHandler")
public class FeedbackBusinessHandler extends AbstractIntegralMsgBusinessHandler {
    @Override
    MsgCreateRequest toMsgCreateRequest(ISUserBehaviorReq request) {
        MsgCreateRequest msgCreateRequest = new MsgCreateRequest();
        msgCreateRequest.setMsgType(MsgTypeEnum.USEFUL_FEEDBACK.getCode());
        msgCreateRequest.setTarget(request.getUserId());
        Map<String, Object> dataMap = Maps.newConcurrentMap();
        dataMap.put("integral", request.getAmount());
        msgCreateRequest.setDataMap(dataMap);
        return msgCreateRequest;
    }

    @Override
    ISChannelType getMsgType() {
        return ISChannelType.FEEDBACK;
    }

}
